package dyyx.server;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;

import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;

public class HelloHandler implements HttpHandler {
    public void handle(HttpExchange t) throws IOException {
      String msg = "hello,simple http server,"+new Date();
      byte [] response = msg.getBytes();
      t.sendResponseHeaders(200, response.length);
      OutputStream os = t.getResponseBody();
      os.write(response);
      os.close();
    }
  }